var e = require("../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../@babel/runtime/regenerator")), t = require("../../../@babel/runtime/helpers/asyncToGenerator"), a = getApp();

Page({
    data: {
        status: 1,
        order_id: 0,
        detailInfo: {},
        custom_name: ""
    },
    onLoad: function(e) {
        if (e.order_id && (this.data.order_id = e.order_id), e.scene) {
            var t = decodeURIComponent(e.scene);
            if (console.log(t), t) {
                var a = [];
                a = t.split("&");
                for (var r = 0; r < a.length; r++) {
                    var n;
                    n = a[r].split("="), console.log(n), "order_id" == n[0] && this.setData({
                        order_id: n[1]
                    });
                }
            }
        }
        this.getDetails();
    },
    onReady: function() {},
    onShow: function() {},
    getDetails: function() {
        var e = this, t = this.data.order_id, r = a.getNetAddresss("plugin.live-install.frontend.order.orderDetail");
        a._postNetWork({
            url: r,
            data: {
                order_id: t
            },
            success: function(t) {
                var r = t.data;
                if (1 != r.result) return a.tips(r.msg);
                r.data.another_name && r.data.another_name.plugin_name && wx.setNavigationBarTitle({
                    title: r.data.another_name.plugin_name
                }), e.setData({
                    detailInfo: r.data,
                    custom_name: r.data.another_name.custom_name || "安装"
                });
            }
        });
    },
    gotoInstallationSeverAfterApply: function(e) {
        var t = e.currentTarget.dataset.item, a = e.currentTarget.dataset.btn, r = this.data.detailInfo.order_sn;
        console.log(t), "goodsApplyRefund" == a.code && wx.navigateTo({
            url: "/packageH/installationSever/installationSeverAfterApply/installationSeverAfterApply?install_order_goods_id=" + t.install_order_goods_id + "&order_sn=" + r
        });
    },
    gotoInstallationSeverAftersale: function() {
        var e = this.data.order_id;
        wx.navigateTo({
            url: "/packageH/installationSever/installationSeverAftersale/installationSeverAftersale?order_id=" + e
        });
    },
    onHide: function() {},
    bindPhone: function(e) {
        var t = e.currentTarget.dataset.mobile;
        wx.showActionSheet({
            itemList: [ "呼叫", "添加联系人", "复制联系方式" ],
            success: function(e) {
                console.log("点击电话 res：", e), 0 == e.tapIndex ? wx.makePhoneCall({
                    phoneNumber: t
                }) : 1 == e.tapIndex ? wx.addPhoneContact({
                    firstName: "",
                    mobilePhoneNumber: t
                }) : 2 == e.tapIndex && wx.setClipboardData({
                    data: t
                });
            }
        });
    },
    onUnload: function() {},
    bindBtnClick: function(r) {
        var n = this;
        return t(e.default.mark(function t() {
            var o, i;
            return e.default.wrap(function(e) {
                for (;;) switch (e.prev = e.next) {
                  case 0:
                    if (o = r.currentTarget.dataset.btn, i = n.data.detailInfo, "orderClose" != o.code) {
                        e.next = 8;
                        break;
                    }
                    return e.next = 5, a.confirm("是否确定".concat(o.name));

                  case 5:
                    if (0 != e.sent) {
                        e.next = 8;
                        break;
                    }
                    return e.abrupt("return");

                  case 8:
                    "orderPay" == o.code ? wx.navigateTo({
                        url: "/packageD/buy/orderPay/orderPay?order_id=" + i.order_id + "&status=2"
                    }) : "comment" == o.code ? wx.navigateTo({
                        url: "/packageD/member/myEvaluation/myEvaluation"
                    }) : "orderApplyRefund" == o.code ? wx.navigateTo({
                        url: "/packageD/member/myOrder/refund/refund?type=1&refundType=installationSever&order_id=" + i.order_id
                    }) : "getRefundList" == o.code ? n.gotoInstallationSeverAftersale() : "orderClose" == o.code && n.cancelOrder(), 
                    console.log(o);

                  case 10:
                  case "end":
                    return e.stop();
                }
            }, t);
        }))();
    },
    cancelOrder: function() {
        var e = this.data.order_id, t = a.getNetAddresss("order.operation.close");
        a._postNetWork({
            url: t,
            data: {
                order_id: e
            },
            success: function(e) {
                var t = e.data;
                if (1 != t.result) return a.tips(t.msg);
                wx.navigateBack();
            }
        });
    },
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        return {
            path: "packageH/installationSever/installationSeverRefund/installationSeverRefund?order_id=" + this.data.order_id
        };
    }
});